var request = require('request'),
	cheerio = require('cheerio'),
	baseUrl = 'http://www.nasdaq.com/symbol/{0}/analyst-research',
	ticker = process.argv[2],
	url = baseUrl.replace('{0}', ticker),
	headers = { 
		'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0'
	};
	
request.get({url: url, headers: headers}, function(err, resp, body) {
	var $ = cheerio.load(body);
	var $tds = $('.box-module-full.marginB15px.row-one table tr:nth-child(1) td:nth-child(3) table tr:nth-child(2) td');
	
	var priceTarget;
	$tds.each(function(i, td){
		var text = $(td).text();
		if (text && text.length > 0) {
			priceTarget = text;
		}
	});
	
	console.log(priceTarget);
});